#!/bin/bash
DT=`date -d '-1 day' +%Y-%m-%d`

#学生打卡记录表
/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '2023-1-31 ' as dt from tbh_student_signin_record where 1=1 and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_tbh_student_signin_record \
-m 1


/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '${DT}' as dt from tbh_student_signin_record where signin_time  between '2019-09-03 00:00:00' and
'${DT} 23:59:59' and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_tbh_student_signin_record \
-m 1

#学生请假申请表
/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '2023-1-31 ' as dt from student_leave_apply where 1=1 and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_student_leave_apply \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '${DT}' as dt from student_leave_apply where create_time between '2010-01-01 00:00:00' and
'${DT} 23:59:59' and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_student_leave_apply \
-m 1

#班级作息表
/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select * ,'2023-1-31 ' as dt from tbh_class_time_table where 1=1 and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_tbh_class_time_table \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *，'${DT}' as dt  from tbh_class_time_table where create_time  between '2010-01-01 00:00:00' and '${DT} 23:59:59' and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_tbh_class_time_table \
-m 1

#课程排课表
/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *,'2023-1-31 ' as dt from course_table_upload_detail where 1=1 and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_course_table_upload_detail \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *，'${DT}' as dt from course_table_upload_detail where class_date  between '2010-01-01 00:00:00' and '${DT} 23:59:59' and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_course_table_upload_detail \
-m 1
#班级在读学生表
/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '2023-1-31 ' as dt from class_studying_student_count where 1=1 and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_class_studying_student_count \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '${DT} ' as dt from class_studying_student_count where studying_date  between '2010-01-01 00:00:00' and '${DT} 23:59:59' and  \$CONDITIONS" \
--hcatalog-database online_edu_ods \
--hcatalog-table ods_class_studying_student_count \
-m 1